/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lab5cyclebuffer;

/**
 *
 * @author Daryna_Ragimova
 */
public class Producer implements Runnable {

    volatile static int i = 0;
    private Buffer buf;

    public Producer(Buffer buf) {
        this.buf = buf;
    }

    @Override
    public void run() {
        while (true) {
            try {
                //Thread.sleep(1000);
                buf.put(i++);
            } catch (InterruptedException ex) {
                System.out.println("Exception while putting");
            }
        }
    }
}
